package cate.game.role.pvp.jungle;

import cate.common.table.d.GDFight;
import cate.common.table.d.GDOperation;
import cate.game.play.proce.play.PlayPO;
import cate.game.play.vo.PlayReportVO;
import cate.game.res.MixRes;
import cate.game.res.MixResAdder;
import cate.game.role.Role;
import cate.game.role.farm.AbstractFarmFTC;
import cate.game.role.pvp.jungle.msg.JungleRobFightResultResp;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass("丛林冒险掠夺FTC")
public class JungleRobFTC extends AbstractFarmFTC<MyJunglePO> {
    @NoteField("本次奖励")
    public MixRes reward;

    public JungleRobFTC(Role role) {
        setup(role);
    }

    @Override
    protected MyJunglePO po(Role role) {
        return role.getPvp().jungle;
    }

    @Override
    public void handleResult(Role role, PlayPO playPO) {
        super.handleResult(role, playPO);
        boolean win = playPO.winner == GDFight.Team.A;
        if (reward != null && !reward.isEmpty()) {
            new MixResAdder().setRes(reward)
                    .setOperation(GDOperation.JUNGLE_ROB)
                    .setSendMailWhenFull(true)
                    .setDialogReward(false)
                    .exe(role);
        }
        if (role.getStatus().isOnline()) {
            role.sendNow(new JungleRobFightResultResp(win, reward, new PlayReportVO(playPO)));
        }
    }
}
